package List;

import java.util.LinkedList;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/4/28
 */

class Queue{
    private LinkedList<Person2> list = new LinkedList();
    //初始化
    void InitQueue(){
        list.clear();
    }
    //判队空
    Boolean isEmpty(){
        return list.isEmpty();
    }
    //入队
    void push(Person2 p){
        list.add(p);
    }
    //出队
    Person2 pop(){
        return list.removeFirst();
    }
    void print(){
        System.out.println(list);
    }

}
class Person2{
    private String name;
    private int age;

    public Person2() {
    }

    public Person2(String name, int age) {
        this.name = name;
        this.age = age;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    public String toString() {
        return "Person2{name = " + name + ", age = " + age + "}";
    }
}
public class Test2 {
    public static void main(String[] args) {
        Person2 p1 = new Person2("John", 23);
        Person2 p2 = new Person2("Jane", 22);
        Person2 p3 = new Person2("Jack", 21);
        Person2 p4 = new Person2("Jill", 23);
        Person2 p5 = new Person2("winnie", 22);
        Queue q = new Queue();
        q.push(p1);
        q.push(p2);
        q.push(p3);
        q.push(p4);
        q.push(p5);
        q.print();
        q.pop();
        q.print();



    }

}
